/*
		
WARNING!
This script is protected by copyright. All rights reserved. Jan-2005

Globase tracking v. 1.1.2

*/

// INIT
var gb_scriptLocation = "http://link.etyper.com/gl/glt.asp";
var gb_setClientCookie= true; // set Globase TId on client domain


// FUNCTIONS
function setCookie(name, value, exp) {
	var expDate = new Date();
	expDate.setTime(expDate.getTime()+exp);
	var expString = (exp=="session")?"" : "; expires="+expDate.toGMTString();
	document.cookie = name+"="+escape(value)+expString+"; path=/";
	expDate = null;
}

function getCookie(name) {
	var result = 0;
	var myCookie = " " + document.cookie + ";";
	var searchName = " " + name + "=";
	var startOfCookie = myCookie.indexOf(searchName);
	var endOfCookie;
	if (startOfCookie != -1) {
		startOfCookie += searchName.length; // skip past name of cookie
		endOfCookie = myCookie.indexOf(";", startOfCookie);
		result = unescape(myCookie.substring(startOfCookie, endOfCookie));
	}
	return result;
}	

// PARSE QUERY STRING
var gb_strSearch = document.location.search;
	gb_strSearch = gb_strSearch.substring(1);
var arrValuePairs = gb_strSearch.split("&");
var arrForm = new Array();
	arrForm["TId"] = 0; // set fallback value
	arrForm["param"] = "985";
	arrForm["conversion"] = "";
if (typeof(arrValuePairs)=="object") {
	for (var i=0;i<arrValuePairs.length;i++){
		var strValuePair = arrValuePairs[i].split("=");
		arrForm[strValuePair[0]] = new String(strValuePair[1]);
	}
}
if ((arrForm["TId"].length==10 || arrForm["TId"].length==11) && gb_setClientCookie) setCookie("GLOBASETID",arrForm["TId"],24*60*60);
var gb_query = "?conversion="+arrForm["conversion"]+"&p1="+arrForm["TId"]+"&p3="+escape(document.title.replace(/ /g,"_"));
	gb_query += (arrForm["param"]!="")? "&p6="+arrForm["param"]:"";
document.write('<script src="'+gb_scriptLocation+gb_query+'" type="text/javascript" language="javascript"><\/script>');

arrForm = null;